/*
 * BusStation.h
 *
 *  Created on: Jul 18, 2013
 *      Author: m
 */

#ifndef BUSSTATION_H_
#define BUSSTATION_H_

#include "application_common.h"
#include "messages.h"
#include "Visitor.h"
#include "ConcurrentMessageQueue.h"

namespace application
{

class BusStation
{
protected:
    busStationId m_busStationId;
    busStationType m_type;
    busId m_attachedBusId;
    communication::MessageQueueInterface<BusStationRequest>* m_inputChannel;
    communication::MessageQueueInterface<NewPassengerNotification>* m_newPassengerNotificationQueue;
    communication::MessageQueueInterface<PassengerToLoad>* m_passengerQueue;

public:
    BusStation( busStationId busStationId, busStationType type );

    virtual ~BusStation();

    void enqueuePassenger();

    void attachBus( busId busId );

protected:
    std::string getLoadRequestQueue( Visitor &visitorName );

    void replyPassengerRequest( BusStationRequest replyChannel, BusStationReply &reply );

    void giveBusPass( Visitor &visitor );
};

} /* namespace application */
#endif /* BUSSTATION_H_ */
